#!/usr/bin/env bash
[ "$LISP_N" ] || exit 1
cd "$(dirname "$0")" || exit 1
run()     { snabb/src/snabb lisper -c lisper${LISP_N}.conf; }
start()   { run > lisper${LISP_N}.log & }
stop()    { pgrep -f "snabb lisper -c lisper${LISP_N}" | xargs kill -9; }
restart() { stop; start; }
watch()   { tail -f lisper${LISP_N}.log; }
if [ "$1" ]; then $1; else stop; run; fi
